package com.example.materialviewpagerdemo;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.materialviewpagerdemo.util.Sendcommand;

import java.util.List;

import cn.jzvd.Jzvd;
import cn.jzvd.JzvdStd;

public class CameraAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{
    List<Object> contents;
    JzvdStd jzvdStd;
    public CameraAdapter(Context context, List<Object> contents) {
        this.contents = contents;
    }
    public int getItemCount() {
        return contents.size();
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = null;
        view = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.content_cardview, parent, false);
        jzvdStd=view.findViewById(R.id.jzText);
        JzvdStd.SAVE_PROGRESS=false;

//        jzvdStd.thumbImageView.setImageDrawable(getDrawable(R.drawable.red));
        return new RecyclerView.ViewHolder(view) {
        };
    }


    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        switch (position){
            case 0:
                jzvdStd.setUp("http://alhlsgw.lechange.com:9001/LCO/3M04660PAJ00077/0/1/20180919194705/dev_20180919194705_0qs0k6icckbi023s.m3u8"
                        ,"监控1", Jzvd.SCREEN_WINDOW_NORMAL);
                break;
            case 1:
                jzvdStd.setUp("http://alhlsgw.lechange.com:9001/LCO/4J00594AAJ37D78/0/1/20181002151852/dev_20181002151852_8ef2z99i2i86n4tb.m3u8"
                        ,"监控2", Jzvd.SCREEN_WINDOW_NORMAL);
                break;
        }
    }
}
